<template>
  <div class="home-view">
    <!-- 文件上传区域 -->
    <SelectFile></SelectFile>
    <!-- 操作按钮 -->
    <div class="action-bar">
      <button v-if="isRun" disabled class="primary-btn flex flex-row">
        <Icon name="i-carbon-circle-dash" class="mr-2 animate-spin"></Icon>
        <span> 转换中 </span>
      </button>
      <button v-else class="primary-btn" @click="run"> 开始转换 </button>
    </div>

    <SettingPanel></SettingPanel>
  </div>
</template>

<script setup lang="ts">
  import useConvert from '@renderer/hooks/useConvert'

  const { run, isRun } = useConvert()
</script>

<style lang="scss" scoped>
  .home-view {
    height: 100%;
    padding: 1.5rem 2rem;
    overflow-y: auto;
  }

  .action-bar {
    display: flex;
    justify-content: flex-end;
  }

  .primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0.5rem;
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 5px 15px rgb(102 126 234 / 30%);
      transform: translateY(-2px);
    }
  }

  .secondary-btn {
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    color: #4b5563;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;

    &:hover {
      background-color: #f9fafb;
    }
  }

  .progress-bar {
    width: 100%;
    height: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
    background-color: #e5e7eb;
    border-radius: 2px;

    .progress-bar-inner {
      height: 100%;
      background-color: #667eea;
      transition: width 0.3s ease;
    }
  }

  .completed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
  }
</style>
